package com.example.demo;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

public class PersonalActivity extends Activity {

    TextView mtextView;
    TextView mtxthome;
    TextView mtxtpio;
    TextView mtxtuser;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_personal);
        bindView();
        Onclicklistener();


        loadloginandRegistry();
    }
    //UI组件初始化
    private void bindView() {
        mtxthome = findViewById(R.id.txt_home);
        mtxtpio = findViewById(R.id.txt_poi);
        mtxtuser = findViewById(R.id.txt_user);
        mtextView =findViewById(R.id.frag_info_login);
    }
    //组件的点击事件
    private void Onclicklistener() {
        //主页点击事件
        mtxthome.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(PersonalActivity.this,MainActivity.class);
                startActivity(intent);
            }
        });
        //动态的点击事件
        mtxtpio.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(PersonalActivity.this,TalkActivity.class);
                startActivity(intent);
            }
        });
        //用户的点击事件
        mtxtuser.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //这里需要判断用户是否登录 如果已经登录



            }
        });

    }

    public void loadloginandRegistry(){
        mtextView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(PersonalActivity.this,LoginActivity.class);
                startActivity(intent);
            }
        });
    }

}
